# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
maintainer="team/kde <bribbers@disroot.org>"
pkgname=kwindowsystem
pkgver=6.7.0
pkgrel=0
pkgdesc="Access to the windowing system"
arch="all"
url="https://community.kde.org/Frameworks"
license="MIT AND (LGPL-2.1-only OR LGPL-3.0-only"
depends_dev="
	libxrender-dev
	plasma-wayland-protocols
	qt6-qtwayland-dev
	xcb-util-keysyms-dev
	xcb-util-wm-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/frameworks/kwindowsystem.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kwindowsystem-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	local skipped_tests="kwindowsystem-(kwindowsystem_threadtest"
	local tests="
		kwindowsystemx11test
		kwindowinfox11test
		compositingenabled_test
		netrootinfotestwm
		"
	case "$CARCH" in
		s390x)
			tests="$tests
				kwindoweffectstest
				netwininfotestwm
				"
			;;
	esac
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	echo $skipped_tests
	xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
4fc2d7e2788c0491220374bf60793505140d899fa828ab471680efb502b45e3145ea4da311b432939519a88a5eefae1676b5ac72a2151bde7e77fa2dba02326c  kwindowsystem-6.7.0.tar.xz
"
